<template>
    <div>
        <el-container>
            <el-aside width="200px">
                <div class="title">Sass平台管理系统</div>
                <el-menu active-text-color="#509ce6" :default-active="defaultActiveMenu" background-color="#262626"
                    text-color="#fff" @select="selectMenu">

                    <el-menu-item index="Home">
                        <el-icon>
                            <HomeFilled />
                        </el-icon>
                        <span>首页</span>
                    </el-menu-item>
                    <el-menu-item index="Overview">
                        <el-icon>
                            <Document />
                        </el-icon>
                        <span>系统概览</span>
                    </el-menu-item>
                    <el-sub-menu index="/user-manage">
                        <template #title>
                            <el-icon>
                                <UserFilled />
                            </el-icon>
                            <span>用户管理</span>
                        </template>
                        <el-menu-item-group title="管理员管理">
                            <el-menu-item index="/user-manage/product">产品管理员</el-menu-item>
                            <el-menu-item index="/user-manage/user">用户管理员</el-menu-item>
                            <el-menu-item index="/user-manage/message">消息管理员</el-menu-item>
                        </el-menu-item-group>
                        <el-menu-item-group title="员工管理">
                            <el-menu-item index="/user-manage/user-list">用户列表</el-menu-item>

                        </el-menu-item-group>
                    </el-sub-menu>
                    <el-sub-menu index="product-manage">
                        <template #title>
                            <el-icon>
                                <Goods />
                            </el-icon>
                            <span>产品管理</span>
                        </template>
                        <el-menu-item-group title="入库管理">
                            <el-menu-item index="/product-manage/product-list">产品列表</el-menu-item>

                        </el-menu-item-group>
                        <el-menu-item-group title="出库管理">
                            <el-menu-item index="/porduct-manage/outbound-list">出库列表</el-menu-item>

                        </el-menu-item-group>
                    </el-sub-menu>
                    <el-sub-menu index="message-manage">
                        <template #title>
                            <el-icon>
                                <ChatDotRound />
                            </el-icon>
                            <span>消息管理</span>
                        </template>
                        <el-menu-item-group title="消息管理">
                            <el-menu-item index="/message-manage/message-list">消息列表</el-menu-item>

                        </el-menu-item-group>
                        <el-menu-item-group title="回收站">
                            <el-menu-item index="/message-manage/recycle-bin">回收站</el-menu-item>

                        </el-menu-item-group>
                    </el-sub-menu>
                    <el-menu-item index="/contract-manage">
                        <el-icon>
                            <Memo />
                        </el-icon>
                        <span>合同管理</span>
                    </el-menu-item>

                    <el-menu-item index="OperateLogs">
                        <el-icon>
                            <List />
                        </el-icon>
                        <span>操作日志</span>
                    </el-menu-item>
                    <el-menu-item index="LoginLogs">
                        <el-icon>
                            <Postcard />
                        </el-icon>
                        <span>登录日志</span>
                    </el-menu-item>
                    <el-menu-item index="SystemSet">
                        <el-icon>
                            <Setting />
                        </el-icon>
                        <span>系统设置</span>
                    </el-menu-item>

                </el-menu>
            </el-aside>
            <el-container>
                <el-header>
                    <div class="header-content-wrap">
                        <div class="welcome">尊敬的 游客 欢迎登录系统</div>
                        <div class="right-wrap">
                            <el-icon>
                                <Message />
                            </el-icon>
                            <el-avatar size="small" class="avatar"
                                src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />
                            <el-dropdown @command="handleCommand">
                                <span class="el-dropdown-link">
                                    设置
                                </span>
                                <template #dropdown>
                                    <el-dropdown-menu>
                                        <el-dropdown-item command="set-account">设置账号</el-dropdown-item>
                                        <el-dropdown-item command="set-avatar">更改头像</el-dropdown-item>
                                        <el-dropdown-item command="logout">退出登录</el-dropdown-item>
                                    </el-dropdown-menu>
                                </template>
                            </el-dropdown>
                        </div>
                    </div>
                </el-header>
                <el-main>
                    <div class="main-header-wrap">
                        <pl-svg-icon icon-name="location" color="#b9b9b9"></pl-svg-icon>
                        <pl-breadcrumb></pl-breadcrumb>
                    </div>
                    <router-view></router-view>
                </el-main>
            </el-container>
        </el-container>


    </div>
</template>

<script lang="ts" setup>

import { ref, reactive } from "vue"
import { useRouter } from "vue-router"


const router = useRouter();

const defaultActiveMenu = ref("Home")

const selectMenu = (name: string) => {
    console.log(name)
    router.push({ name })
}

const handleCommand = (command: string | number | string) => {

    switch (command) {
        case 'set-account':
            break;
        case 'set-avatar':
            break;
        case "logout":
            router.push("/login");
            break;
        default:
            break;
    }

}
</script>
<style lang='scss' scoped>
.el-aside {
    height: 100vh;
    background-color: #262626;

    .title {
        height: 50px;
        text-align: center;
        line-height: 50px;
        color: #fff;
    }

    .el-menu {
        overflow-y: auto;
        height: calc(100vh - 50px);
        border: 0;
    }

    .el-menu-item:hover {
        background-color: #7c7c7c;
    }
}

.el-header {
    background-color: #262626;
    height: 50px;
}

.header-content-wrap {
    display: flex;
    justify-content: space-between;
    height: 50px;

    color: #fff;

    .welcome {
        height: 50px;
        line-height: 50px;
    }

    .right-wrap {
        height: 50px;
        display: flex;
        align-items: center;

        .el-icon,
        .el-dropdown {
            cursor: pointer;
            color: #fff;
        }

        .avatar {
            margin: 0 15px;
            cursor: pointer;
        }
    }

}

.el-main {
    padding: 0;
    background-color: $commonGrey;

    .main-header-wrap {
        display: flex;
        align-items: center;
        height: 40px;
        padding: 0 20px;

        .svg-icon {
            margin-right: 10px;
        }
    }


}
</style>